﻿using System;
using System.Collections.Generic;
using System.Text;
using jade.core;
using MarketSimulator.Utils.Maps;

namespace MarketSimulator.Utils.Attributes
{
    public class StorageAttributes : GeneralAttributes
    {
        #region Properties

        public const string StorageServiceName = "[STORAGE]";
        public const string StorageFacilityInfoFormat = "[ locationId = {0} | capacity = {1} | cost =  {2}]";

        /// <summary>
        /// Storage Facility
        /// </summary>
        public StorageFacility StorageFacility { get; private set; }

        #endregion

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="location"></param>
        /// <param name="shoppingList"></param>
        public StorageAttributes(Agent agent, StorageFacility storageFaility, Action<string> agentsChat) : base(agentsChat)
        {
            JadeAgent = agent;
            StorageFacility = storageFaility;
        }

        #region Methods
        
        /// <summary>
        /// Register Actor
        /// </summary>
        public override void RegisterAgent()
        {
            YellowPages.RegisterService(StorageServiceName, JadeAgent);
        }

        /// <summary>
        /// Get Product Information as String
        /// </summary>
        /// <returns></returns>
        public string GetStorageInfoString()
        {
            return string.Format(StorageFacilityInfoFormat, StorageFacility.Location, StorageFacility.RemainingCapacity, StorageFacility.CostPerUnit);
        }

        #endregion
    }
}
